package 工厂方法模式.结合策略模式.商场促销再升级;

import 装饰模式.商场促销实例.CashNormal;
import 装饰模式.商场促销实例.CashRebate;
import 装饰模式.商场促销实例.CashReturn;
import 装饰模式.商场促销实例.ISale;

/**
 * @author zyl
 * @Description
 * @since 2024/1/3 14:28
 */

//先打折在满减
public class CashRebateReturn implements IFactory{
    //打多少折
    private double moneyRebate  = 1d;
    //返利条件
    private double moneyCondition = 0d;
    //返利值
    private double moneyReturn = 0d;

    public CashRebateReturn(double moneyRebate, double moneyCondition, double moneyReturn) {
        this.moneyRebate = moneyRebate;
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }
    //先打折再满减
    @Override
    public ISale createSalesModel() {
        CashNormal cashNormal = new CashNormal();
        CashReturn cashReturn = new CashReturn(this.moneyCondition,this.moneyReturn);
        CashRebate cashRebate = new CashRebate(this.moneyRebate);
        cashReturn.decorate(cashNormal);
        cashRebate.decorate(cashReturn);
        return cashRebate;
    }
}
